home *** CD-ROM | disk | FTP | other *** search
/ Guide To Cracking 2002 / Guide_to_Cracking_2002.iso / Tutorials / Nag and Time Trial / nag / ns16.txt < prev    next >
Encoding:
Text File  |  2001-02-03  |  8.7 KB  |  192 lines

  1. Target Program: Ecco 4.01 32-bit
  2. Protection: Nag(s), 30 day time limit
  3. Cracked by: drlan [Me'97/C4N]!
  4. Location: http://www.shareware.com or http://www.download.com
  5.  
  6. Tools needed:
  7. - SoftICE Win95 3.01
  8. - Hex Editor (I like PSEdit and Hex Workshop)
  9.  
  10. Conventions used:
  11. > denotes a SoftICE command
  12.  
  13. Download the target and run it a few times to get a feel for what's going on.
  14. You'll notice a nice little reminder that the program will expire in 30 days.
  15. That doesn't sound like quite enough time for a thorough evaluation, so let's
  16. see what we can do...
  17.  
  18. First, let's see what happens once we're past the point of no return.  Set
  19. your date ahead by more than 30 days.  Now run the target and see what it
  20. does.  Try to load a file.  Hmm, now our friendly reminder has turned nasty
  21. on us and says that the program has expired and that we should contact the
  22. vendor to purchase a copy.  Bummer.  Set the date back to normal and run one
  23. more time.  Try to load a file.  Hey, it works.  That's good.  So, it hasn't
  24. left behind any kind of nasty marker that would keep us from our work.  So,
  25. let's get to work!
  26.  
  27. We could try setting a breakpoint in SoftICE on system date functions, like
  28. GetLocalTime and GetSystemTime.  However, this is a calendaring program and
  29. makes many, many calls to GetLocalTime which would make this difficult.
  30.  
  31. Instead, let's investigate the nag screen a little further.  There are lots
  32. of different ways to breakpoint and try to pinpoint the nag screen.  I think
  33. I used HWND ecco32 when the nag was displayed to find out what windows were
  34. open.  Then I set a breakpoint on the most likely window function.  It was
  35. something like this:
  36.  
  37. >TASK                   ; let's find our target's name (it is ecco32)
  38.  
  39. >HWND ecco32            ; let's see what windows our target has open
  40.  
  41. >BMSG 164 wm_command    ; now set a breakpoint on the likely window
  42.  
  43. NOTE: You may see 2 other windows called Mauishooter and Mauipowerpal.
  44. These aren't the ones we're interested in...  Look for the first one
  45. after these.
  46.  
  47. Then click on the OK button.  SoftICE will pop.  Press F12 several times
  48. until you're back in the Ecco32 code.  You should see something like this:
  49.  
  50. :004331E5 FF1508657400    CALL USER32!DialogBoxParamA
  51.           837DF400        CMP DWORD PTR [EBP-0C], 00
  52.           8945F0          MOV [EBP-10], EAX
  53.           740E            JZ 00433202
  54.  
  55. So, it's the call to DialogBoxParamA that places the friendly reminder on
  56. the screen.  Let's follow the code for a while and see where we go.  Press
  57. F10 several times.  You should hit 2 RET functions (RETurn).  After you
  58. return from the second one, you should see some code that looks like this:
  59.  
  60. :005C59DA E84EACF2FF    CALL 004F062D   ; go get some date information
  61.           662BC6        SUB AX, SI      ; subtract install date from current
  62.           663D1E00      CMP AX, 001E    ; is it less than 1E (hex), 30 (dec)
  63.           7218          JB 005C5A00     ; jump if still in evaluation period
  64.  
  65. Now, our goal is to "extend" our evaluation period.  Why not just make AX
  66. equal zero?  Zero is an aweful lot less than 30, so we can evaluate forever.
  67. To do this, we'll change the SUB AX, SI into XOR EAX, EAX (this is a 32 bit
  68. program, so let's use 32 bit registers).  When you XOR (eXclusive OR) any
  69. number with itself, the result is always zero.  Setting EAX to zero will take
  70. care of AX.  You can try this live in SoftICE by assembling in our new stuff.
  71.  
  72. F10 until you are on the SUB AX, SI line.  Then do this:
  73.  
  74. >A                      ; to assemble in our new instructions
  75. >XOR EAX, EAX           ; set EAX/AX to zero
  76. >NOP                    ; fill the remaining 1 byte space
  77. >(press ESC)
  78.  
  79. We have to add a NOP (No OPeration) because the XOR EAX, EAX is only 2 bytes.
  80. We need to fill the extra space because SUB AX, SI is 3 bytes.  Your code
  81. should now look like this:
  82.  
  83. :005C59DA E84EACF2FF    CALL 004F062D   ; go get some date information
  84.           33CO          XOR EAX, EAX    ; set EAX/AX to zero
  85.           90            NOP             ; do nothing for 1 instruction
  86.           663D1E00      CMP AX, 001E    ; is AX less than 1E (hex), 30 (dec)
  87.           7218          JB 005C5A00     ; you bet it is, so continue eval!!!
  88.  
  89. Now we've defeated the 30 day time limit.  How about getting rid of the nag
  90. screen, too?  I think we can do that!
  91.  
  92. Clear any existing breakpoints in SoftICE.
  93.  
  94. >BC *
  95.  
  96. Remember earlier we discovered that the nag was being called by the
  97. DialogBoxParamA function?  Set a breakpoint on this.
  98.  
  99. >BPX DialogBoxParamA
  100.  
  101. Then press Ctrl-D or F5 to run the program.  Try to open a file.  SoftICE
  102. will pop on the DialogBoxParamA function.  Press F12 to return from the
  103. function.  Click on OK on the friendly reminder and you will drop back
  104. into SoftICE on the line of code right after the CALL USER32!DialogBoxParamA.
  105. I initially thought I could just wipeout this CALL to USER32!DialogBoxParamA.
  106. Boy was I wrong!  It looked like it worked, but it de-stabilized the program.
  107. I guess other funtions call this function from the same place.  They load all
  108. their setup stuff first, then call it.  So, we can't just wipe this call out.
  109.  
  110. So, let's backtrack a little and find out how we got here (who called this).
  111. To do this, press F12 again to RETurn to where this call came from.  You
  112. should see a section of code that looks like this:
  113.  
  114. :00432FAE C20C00        RET 000C
  115.           55            PUSH EBP
  116.           8BEC          MOV EBP, ESP
  117.           6A00          PUSH 00
  118.           6A00          PUSH 00
  119.           FF7518        PUSH DWORD PTR [EBP+18]
  120.           FF7510        PUSH DWORD PTR [EBP+10]
  121.           FF750C        PUSH DWORD PTR [EBP+0C]
  122.           FF7508        PUSH DWORD PTR [EBP+08]
  123.           E824000000    CALL 00432FF0                   ; nasty call
  124.           5D            POP EBP                         ; F12 brings you here
  125.           C21400        RET 0014
  126.  
  127. I tried blasting this call too, but this still isn't the right one.  When I
  128. got rid of this one, other functions stopped working (ones that needed the
  129. dialogbox function, I guess).  So, let's keep backtracking.  Press F12 again
  130. and you should land at a code segment that looks like this:
  131.  
  132. :005C5978 E839D6E6FF    CALL 00432FB1                   ; nasty call
  133.           83F8FF        CMP EAX, -01                    ; F12 brings you here
  134.           JNZ           005C5982                        ; set to jump
  135.  
  136. Ok, this looks a little easier (and lots cleaner).  We don't want to make
  137. the CALL 005C5982.  We know the conditional jump (JNZ 005C5982) is set to
  138. jump.  So, let's just change the CALL 00432FB1 into JMP 005C5982 and pad
  139. the remaining spaces with INC EAX, NOP, DEC EAX.  This makes it a 5 byte
  140. for 5 byte code change.
  141.  
  142. So we change:
  143.  
  144.           E839D6E6FF    CALL 00432FB1                   ; nasty call
  145.  
  146. into:
  147.  
  148.           EB0D          JMP 005C5982                    ; no more nasty call
  149.           40            INC EAX                         ; just filling space
  150.           90            NOP                             ; ditto
  151.           48            DEC EAX                         ; ditto
  152.  
  153. You can try this live in SoftICE by placing a breakpoint on the CALL line.
  154. Do this using BPX address, where address equals the segment:offset of the
  155. instruction line.  Or, simply double-click on the line to set the breakpoint.
  156. Then press Ctrl-D or F5 to continue running the program.  Try to load a file.
  157. SoftICE will pop on your breakpoint.  Let's assemble in our new instructions.
  158.  
  159. >A                      ; to assemble in our new instructions
  160. >JMP 005C5982           ; let's blow away the call and just move on
  161. >INC EAX                ; fill the remaining space from the old 5 byte call
  162. >NOP                    ; ditto (but we don't want 3 NOPs in a row)
  163. >DEC EAX                ; so we INC EAX, DEC EAX and stick a NOP in between
  164. >(press ESC)
  165.  
  166. Then press Ctrl-D or F5 to continue running the program.  Try to load a file.
  167. The file should load, sans nag screen.  Cool!
  168.  
  169. Time to transfer our live crack into something more useful and longer lasting.
  170. We need to hex edit the ecco32.exe program to replace the bad old instructions
  171. with our nice new ones.
  172.  
  173. Nag screen(s):
  174. Search for:     E839D6E6FF      ; was the CALL 00432FB1
  175. Replace with:   EB0D409048      ; now INC EAX, NOP, DEC EAX
  176.  
  177. 30 day time limit:
  178. Search for:     E84EACF2FF662BC6        ; need a long string to be unique
  179. Replace with:             33C090
  180.  
  181. NOTE: Only change the last 3 bytes (662BC6 into 33C090).  Leave the rest
  182. (E84EACF2FF) alone.
  183.  
  184. That's it for this lesson.  Hope this was fun and instructional.
  185.  
  186. Disclaimer: THIS ESSAY IS FOR EDUCATIONAL PURPOSES ONLY.  ANY USE, MIS-USE
  187. OR ILLEGAL ACTIVITY IS THE SOLE RESPONSIBILITY OF THE READER.
  188.  
  189. GreetZ: Everyone in [Me'97/C4N], PC'97, UCF, fravia and +ORC, Razzia!
  190.  
  191. drlan
  192.